package servlet;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import service.Servicet;
import vo.Books;

@WebServlet("/Personage")
public class PersonageServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;
	private Servicet s = new Servicet();

	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		request.setCharacterEncoding("utf-8"); 
		String name = request.getParameter("name");
		List<Books> list = new ArrayList<Books>();
		list.clear();
		list = s.fun(name);
		HttpSession session = request.getSession();
		session.setAttribute("name", name);		
		session.setAttribute("book", list);
		response.sendRedirect("aaa/Dome3.jsp");
	}

	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		doGet(request, response);
	}

}
